package com.report.controller;

import com.report.dto.Response;
import com.report.entity.CompanyTreeStructure;
import com.report.service.CompanyTreeStructureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * 企业树形结构
 */
@RestController
@RequestMapping("/api/companyTreeStructure")
public class CompanyTreeStructureController {


    @Autowired
    private CompanyTreeStructureService companyTreeStructureService;

    /**
     * 获取企业树形结构
     *
     * @return
     */
    @RequestMapping("/getCompanyTree")
    public Response getCompanyTree(String auditCompanyUscc) {

        Response response = new Response();
        response.setStatus("success");
        response.setData(companyTreeStructureService.getCompanyTree(auditCompanyUscc));
        return response;
    }

    /**
     * 添加企业树形结构
     *
     * @param companyTreeStructure
     * @return
     */
    @RequestMapping(value = "/addCompanyTree", method = RequestMethod.POST)
    public Response addCompanyTree(@RequestBody CompanyTreeStructure companyTreeStructure) {

        return companyTreeStructureService.addCompanyTree(companyTreeStructure);
    }

    /**
     * 删除企业树形结构
     *
     * @param companyTreeStructure
     * @return
     */
    @RequestMapping(value = "/deleteCompanyTree", method = RequestMethod.POST)
    public Response deleteCompanyTree(@RequestBody CompanyTreeStructure companyTreeStructure) {

        return companyTreeStructureService.deleteCompanyTree(companyTreeStructure);
    }


}
